// pages/map/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    nearShopSel:[],//当前门店信息
    markers:{},//地图标记点
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   const that=this;
   that.setData({
     nearShopSel: JSON.parse(options.nearShopSel)
   })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    const that = this;
    that.setData({
      markers:[{
        latitude: that.data.nearShopSel.latitude,
        longitude: that.data.nearShopSel.longitude,
        title: that.data.nearShopSel.shop_name
      }]
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  //当前门店点击导航
  tonavigation:function(){
    const that=this;
      wx.openLocation({
        latitude: that.data.nearShopSel.latitude*1,
        longitude: that.data.nearShopSel.longitude*1,
        name: that.data.nearShopSel.shop_name,
        address: that.data.nearShopSel.address
      })
  }
})